﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrototypePatternExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var stormCommander = new Commander();
            var infantry = new Infantry();

            Console.WriteLine("Firepower: {0}, Armor: {1}", stormCommander.FirePower, stormCommander.Armor);
            Console.WriteLine("Firepower: {0}, Armor: {1}", infantry.FirePower, infantry.Armor);

            Console.WriteLine("-------------");

            var stormCommander2 = stormCommander.Clone() as Commander;
            var infantry2 = infantry.Clone() as Infantry;


            if (stormCommander2 != null)
                Console.WriteLine("Firepower: {0}, Armor: {1}", stormCommander2.FirePower, stormCommander2.Armor);

            if (infantry2 != null)
                Console.WriteLine("Firepower: {0}, Armor: {1}", infantry2.FirePower, infantry2.Armor);

            Console.ReadLine();
        }
    }

    public abstract class StroomTrooper : ICloneable
    {
        public string FirePower { get; set; }
        public string Armor { get; set; }
        public object Clone()
        {
            return MemberwiseClone();
        }
    }

    public class Commander : StroomTrooper
    {
        public Commander()
        {
            this.Armor = "15";
            this.FirePower = "30";
        }
    }

    public class Infantry : StroomTrooper
    {
        public Infantry()
        {
            this.Armor = "30";
            this.FirePower = "10";
        }
    }

}
